<template>
  <div class="kill">
    <div class="top">
      <p class="tf">
        <span class="hg">嗨购秒杀</span>
        <span>8点场</span>
        <van-count-down :time="time">
          <template #default="timeData">
            <span class="block">{{ timeData.hours }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.minutes }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.seconds }}</span>
          </template>
        </van-count-down>
      </p>
      <div class="bk">
        爆款轮番秒
        <span class="dy">&gt;</span>
      </div>
    </div>
    <div class="btm">
      <div class="picture" v-for="(item, index) in data" :key="index">
        <figure @click="ms(item.proid)">
          <img :src="item.img1" />
          <figcaption>
            <span class="money">￥{{ item.originprice }}</span>
          </figcaption>
        </figure>
      </div>
    </div>
  </div>
</template>

<script scoped>
import axios from "axios";
export default {
  name: "SecondKill",
  data() {
    return {
      time: 60 * 60 * 1000,
      data: [],
    };
  },
  created() {
    axios({
      url: "/api/pro/seckilllist",
    }).then((res) => {
      // console.log(res.data.data,'res.data.data');
      this.data = res.data.data;
      // console.log("this.data: ", this.data);
    });
  },
  methods: {
    ms(id) {
      /*   console.log(id);
      this.$service.get("/api/pro/detail/:proid",{
        proid:id
      }).then((res)=>{
        console.log(res,"res");
      }) */
      this.$router.push("/DetailVue/" + id);
    },
  },
};
</script>

<style scoped>
.kill {
  /* height: 7rem; */
  /* background-color: skyblue; */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.colon {
  display: inline-block;
  margin: 0 4px;
  color: #ee0a24;
}
.block {
  display: inline-block;
  width: 20px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background-color: #ee0a24;
  border-radius: 0.25rem;
}
.top {
  display: flex;
  justify-content: space-around;
  height: 3rem;
  align-items: center;
  position: relative;
}
.tf {
  display: flex;
  justify-content: space-between;
  width: 52%;
  font-size: 14px;
  text-align: center;
  margin-right: 50px;
  text-align: center;
}
.hg {
  font-size: 16px;
  font-weight: 600;
}
.bk {
  color: #ee0a24;
  margin-right: 0.5rem;
}
.dy {
  background-color: #ee0a24;
  color: white;
  border-radius: 50%;
  display: inline-block;
  width: 12px;
  text-align: center;
  font-size: 12px;
  position: absolute;
}
.btm {
  display: flex;
  width: 100%;
  justify-content: space-around;
  margin-top: 10px;
}
.picture {
  width: 15%;
  flex-shrink: 0;
}
img {
  width: 100%;
  height: 60px;
}
.money {
  color: #ee0a24;
}
</style>